--
-- vhdl architecture fietscomputer_lib.i_multiplexer.v1
--
-- created:
--          by - jcmooije.unknown (dtp7985)
--          at - 14:59:39  4-06-2010
--
library ieee;
use ieee.std_logic_1164.all;

entity fc_12to3mux is
  port( 
  i_a1      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_a2      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_a3      : in     std_logic := '0';
  i_b1      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_b2      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_b3      : in     std_logic := '0';
  i_c1      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_c2      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_c3      : in     std_logic := '0';
  i_d1      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_d2      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_d3      : in     std_logic := '0';
  i_e1      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_e2      : in     std_logic_vector(63 downto 0) := (others => '0');
  i_e3      : in     std_logic := '0';
  
  inp_sel   : in     std_logic_vector( 2 downto 0);
  
  x1        : out    std_logic_vector(63 downto 0);
  x2        : out    std_logic_vector(63 downto 0);
  x3        : out    std_logic;
  
  leds_out : out std_logic_vector(17 downto 0)
  );
end fc_12to3mux ;

--------------------------------------------
---------------------------------------------

architecture behavioural of fc_12to3mux is
begin
	process(i_a1, i_a2, i_a3, i_b1, i_b2, i_b3, i_c1, i_c2, i_c3, i_d1, i_d2, i_d3, i_e1, i_e2, i_e3, inp_sel) is
		variable leds : std_logic_vector(17 downto 0);
	begin
		case inp_sel is
			when "000" =>
				x1 <= i_a1;
				x2 <= i_a2;
				x3 <= i_a3;
				
				leds := "111000000000000000";
				leds(0) := i_a3;
			when "001" =>
				x1 <= i_b1;
				x2 <= i_b2;
				x3 <= i_b3;
				
				leds := "000111000000000000";
				leds(0) := i_b3;
			when "010" =>
				x1 <= i_c1;
				x2 <= i_c2;
				x3 <= i_c3;
				
				leds := "000000111000000000";
				leds(0) := i_c3;
			when "011" =>
				x1 <= i_d1;
				x2 <= i_d2;
				x3 <= i_d3;
				
				leds := "000000000111000000";
				leds(0) := i_d3;
			when "100" =>
				x1 <= i_e1;
				x2 <= i_e2;
				x3 <= i_e3;
				
				leds := "000000000000111000";
				leds(0) := i_e3;
			when others =>
				x1 <= (others => '0');
				x2 <= (others => '0');
				x3 <= '0';
				
				leds := "000000000000111000";
		end case;
		
		leds_out <= leds; 
	end process;  
end architecture behavioural;


